<?php

namespace App\Models\Article;

use App\Models\Common\CommonModel;
use Illuminate\Database\Eloquent\Factories\HasFactory;

class ArticleClassify extends CommonModel
{
    use HasFactory;
    protected $table = 'article_classify';

    public function moreChildren() {
        return $this->hasMany(ArticleClassify::class,'pid','id');
    }

    public function children() {
        return $this->moreChildren()->with(['children']);
    }

    public function getParent(){
        return $this->where('id',$this->pid)->first();
    }

}
